//Denises Change
#include "FileSystem.h"
using namespace std;
int main(int argc, char **argv) {
	FileSystem *myfs;
	string command;
	// Check the command line arguments 
	if (argc == 2) {
		command = argv[1];
		if (command != "--cache") {
			cerr << "Syntax: ./filesystem (--cache)" << endl;
			exit(1);
		}
		else {
			// Use cache.
			myfs = new FileSystem(true);
		}
	}
	// Print an error if the command line arguments are off 
	else if (argc > 2) {
		cerr << "Syntax: ./filesystem (--cache)" << endl;
		exit(1);
	}
	// Do not use the cache
	else {	
		myfs = new FileSystem(false);
	}
	// Start shell
	cout << "sh> ";
	while (getline(cin, command)) {
		if (command != "") 
			// Process command.  If it returns -1, the command
			// entered was quit.
			if (myfs->ProcessCommand(command) == -1)
				break;

		cout << "sh> ";
	}
	cout << endl;
	delete(myfs);	
	// Clean up (freeing, closing file, etc.)
}
